import java.util.Scanner;

/**
 * <p>字符串最后一个单词的长度</p>
 *
 * @author: YuanChilde
 * @date: 2020-02-17 8:01
 * @version: 1.0
 * Modification History:
 * Date    Author      Version     Description
 * -----------------------------------------------------------------
 * 2020-02-17 8:01    YuanChilde     1.0        新增
 */
public class Demo1 {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        if("".equals(str) || str.length()>5000){
            System.exit(1);
        }
        String[] strs = str.split(" ");
        int length = strs[strs.length-1].length();
        System.out.println(length);
    }

    public void demo2(){
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        int length = str.length();
        int count = 0;
        for (int i = length - 1; i >= 0; i--) {
            if (str.charAt(i)==' ') {
                break;
            }
            count++;
        }
        System.out.println(count);
    }
}
